// 前端路由控制
import Vue from 'vue'
import Router from 'vue-router'

// components
import login from '@/components/views/login/index'                 // 欢迎页面
import signin from '@/components/views/login/signin'               // 登陆
import signup from '@/components/views/login/signup'               // 注册

import home from '@/components/views/home/index'                   // 主页
import homeIndex from '@/components/views/home/_index'             // 首页
import aim from '@/components/views/home/aim/index'                // 我的公益组织
import group from '@/components/views/home/group/index'            // 我的团队
import groupInvite from '@/components/views/home/group/_invite'    // 团队邀请
import help from '@/components/views/home/help/index'              // 帮助页
import mySurvey from '@/components/views/home/survey/index'        // 我的调查

import survey from '@/components/views/survey/index'               // 创建调查页
import surveyIndex1 from '@/components/views/survey/_index_1'      // 包含以1-5
import surveyIndex2 from '@/components/views/survey/_index_2'
import surveyIndex3 from '@/components/views/survey/_index_3'
import surveyIndex4 from '@/components/views/survey/_index_4'
import surveyIndex5 from '@/components/views/survey/_index_5'

import tutorial from '@/components/views/showoff/index'            // 引导页

import question from '@/components/views/question/index'           // 回答问题页

import result from '@/components/views/result/index'               // 结果展示页

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '*',
      redirect: '/login'
    },
    {
      path: '/login',
      name: 'login',
      component: login
    },
    {
      path: '/login/signin',
      name: 'signin',
      component: signin
    },
    {
      path: '/login/signup',
      name: 'signup',
      component: signup
    },
    {
      path: '/home',
      component: home,
      children: [
        {
          path: '',
          name: 'homeIndex',
          component: homeIndex
        },
        {
          path: 'group',
          component: group,
          name: 'groupIndex',
          children: [
            {
              path: 'invite',
              name: 'groupInvite',
              component: groupInvite
            }
          ]
        },
        {
          path: 'aim',
          name: 'aim',
          component: aim
        },
        {
          path: 'help',
          name: 'help',
          component: help
        },
        {
          path: 'mySurvey',
          name: 'mySurvey',
          component: mySurvey
        }
      ]
    },
    {
      path: '/login/tutorial',
      name: 'tutorial',
      component: tutorial
    },
    {
      path: '/home/survey',
      component: survey,
      children: [
        {
          path: '',
          name: 'surveyIndex',
          component: surveyIndex1
        },
        {
          path: 'second',
          name: 'surveyIndex2',
          component: surveyIndex2
        },
        {
          path: 'third',
          name: 'surveyIndex3',
          component: surveyIndex3
        },
        {
          path: 'forth',
          name: 'surveyIndex4',
          component: surveyIndex4
        },
        {
          path: 'fifth',
          name: 'surveyIndex5',
          component: surveyIndex5
        }
      ]
    },
    {
      path: '/home/question/:id',
      name: 'question',
      component: question
    },
    {
      path: '/home/result/:id',
      name: 'result',
      component: result
    }
  ]
})
